import request from '@/utils/request'

export function uploadSingleFile(data, progress) {
  return request({
    url: '/api/file/uploadSingleFile',
    method: 'post',
    data,
    onUploadProgress: function (progressEvent) { //原生获取上传进度的事件
      console.log(progressEvent)
      const percent = (Number(progressEvent.loaded / progressEvent.total) * 100).toFixed(2);
      progress(percent);
    }
  })
}

export function uploadFiles(data) {
  return request({
    url: '/api/file/uploadFiles',
    method: 'post',
    data
  })
}
export function deleteFile(data) {
  return request({
    url: '/api/file/deleteFile',
    method: 'post',
    data
  })
}


